#pragma once

#include "includes.h"

using namespace std;

class SceneLoader {

public:
	Scene* s;
	Illumination* i;
	map<string, Primitive*> primitivesMap;
	map<string, vector<Transformation*>> transformsMap;
	map<string, Material*> materialsMap;
	map<string, Texture*> texturesMap;
	vector<Light*> lightsMap;
	vector<View*> viewsMap;
	map<string, Component*> componentsMap;
	SceneLoader(const char * fileName);
	bool loadScene();
	void attributeElements();
	void runScene(bool change, char key);

private:
	TiXmlElement* viewsElement;
	TiXmlElement* lightsElement;
	TiXmlElement* texturesElement;
	TiXmlElement* materialsElement;
	TiXmlElement* transformationsElement;
	TiXmlElement* primitivesElement;
	TiXmlElement* componentsElement;
	TiXmlElement* sceneElement;
	TiXmlElement* illuminationElement;
	TiXmlElement* root;
	TiXmlDocument doc;

	void loadSceneInfo();
	void loadViews();
	void loadLights();
	void loadTextures();
	void loadMaterials();
	void loadTransformations();
	void loadPrimitives();
	void loadComponents();
	void loadIllumination();
};